#ifndef LUA_PARAMETERS_SWEEP_BUILDING
#define LUA_PARAMETERS_SWEEP_BUILDING
#include <luaParameters/config.h>
#include <luaParameters/luaParameters.h>

namespace lua{
	struct luaState;
};
namespace lua{
	class
	LUA_PARAMETERS_EXPORT_API
	luaParametersSweep{
		friend class boost::serialization::access;
		template<class Archive>
			void serialize(Archive & ar, const unsigned int ver)
		{
			ar  & m_parameters & m_bNeedEvaluate & m_bValid & m_bSynatexError;
		}
	protected:
		std::shared_ptr<lua::luaParameters> m_parameters;
		std::shared_ptr<lua::luaState> m_state;

		std::map<std::string, std::vector<double> > m_varibles;
		std::vector< std::vector<double> > m_parasSheet;
		mutable bool m_bNeedEvaluate;
		mutable bool m_bValid;
		mutable bool m_bSynatexError;
		sol::table m_module;
	public:
		luaParametersSweep();
		virtual void set_parameters(std::shared_ptr<lua::luaParameters> p){ m_parameters = p; };

		void setState(std::shared_ptr<lua::luaState>);
		std::shared_ptr<lua::luaState> state(){ return m_state;};
		bool initState();

		//virtual void build() const;
		virtual bool valid() const { return m_bValid; }
		virtual bool need_evaluate() const { return m_bNeedEvaluate; }
		virtual bool synatex_error() const { return m_bSynatexError; }

		bool value( const std::string& key, std::vector<double>& val);
		bool set_value( const std::string& key, const std::vector<double>& val);

		bool init_data_sheet();

	};
};

#endif
